<template>
	<view>
		<image src="../../static/me/bg2.jpg" mode="" style="position: fixed;top: 0; left: 0;width: 100vw; height: 100vh;"></image>
		<view style="padding-top: 30vh;"></view>
		<view class="content" >
			<view class="entrance">
				<view class="item" @tap="toReserveWater">
					<image src="../../static/likeFx/31.png" class="icon"></image>
					<view class="title">订水</view>
				</view>
				<view class="item" @tap="toFinishWaterTask">
					<image src="../../static/likeFx/23.png" class="icon"></image>
					<view class="title">送水</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: null
			}
		},
		onShow() {
			this.userInfo = uni.getStorageSync("userInfo")
		},
		methods: {
			toReserveWater() {
				if(!this.userInfo) {
					uni.navigateTo({url: '/pages/login/login'})
					return
				}
				if(this.userInfo.userType != '学生'){
					this.$msg('学生才能订水')
					return;
				}
				
				uni.navigateTo({
					url: "/pages/reserve/reserveWaterIndex"	
				})
			},
			toFinishWaterTask() {
				if(!this.userInfo) {
					uni.navigateTo({url: '/pages/login/login'})
					return
				}
				if(this.userInfo.userType != '送水员'){
					this.$msg('您不是送水员')
					return;
				}
				
				uni.navigateTo({
					url: "/pages/task/taskIndex"	
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
/* #ifdef H5 */
page {
	height: auto;
	min-height: 100%;
}
/* #endif */


.content {
	padding: 0 30rpx;
}

.entrance {
	position: relative;
	margin-bottom: 30rpx;
	border-radius: 10rpx;
	background-color: #ffffff;
	box-shadow: $box-shadow;
	padding: 30rpx 0;
	display: flex;
	align-items: center;
	justify-content: center;
	
	.item {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		position: relative;
		
		&:nth-child(1):after {
			content: '';
			position: absolute;
			width: 1rpx;
			background-color: #ddd;
			right: 0;
			height: 100%;
			transform: scaleX(0.5) scaleY(0.8);
		}
		
		.icon {
			width: 84rpx;
			height: 84rpx;
			margin: 20rpx;
		}
		
		.title {
			font-size: 30rpx;
			color: $text-color-base;
			font-weight: 600;
		}
	}
}



</style>
